class Monkey:
    def show_info(self):
        print(f'我是：{self.name}，我会{self.skill}')


# mokey = Monkey()
# # 对象的属性可以在外面设置
# mokey.name = '孙悟空'
# mokey.skill = '筋斗云，七十二变'
# mokey.show_info()

class Person:
    # 初识化方法
    def __init__(self, name, age):
        self.name = name
        self.age = age
        # 因为有__str__方法打印的时候自动调用
        print(f'{self}创建成功')

    def get_older(self):
        self.age += 1

    def get_younger(self):
        self.age -= 1

    # 析构方法
    def __del__(self):
        # 因为有__str__方法打印的时候自动调用
        print(f'{self}销毁成功')
        del self.name
        del self.age

    # __str__当打印（print）对象的时候自动触发，类似于java的toString方法
    def __str__(self):
        return f'我是{self.name}，今年{self.age}岁了'


# Person('陈晓东', 28)
# person = Person('陈晓东', 28)
# print(person.name)
# print(person.age)
# person2 = Person('yyy',15)


# person = Person('陈晓东', 18)
# person.get_older()
# print(person)
# person.get_younger()
# person.get_younger()
# print(person)

class Girl(object):
    def __init__(self,name):
        self.name = name
        self.__age = 18

    def get(self):
        return self.__age

girl = Girl('余奕奕')
print(girl.name)
print(girl.get())